import hashlib
from mysite2.settings import SECRET_KEY


# MD5加密,对密码加密
# 盐使用django setting中的SECRET_KEY
def md5(data_string):
    obj = hashlib.md5(SECRET_KEY.encode('utf8'))
    obj.update(data_string.encode('utf-8'))
    return obj.hexdigest()
